using PuppeteerSharp;
using WebAgent;

var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddFilter("System.Net.Http.HttpClient", LogLevel.Warning);
builder.Services.AddControllers();
builder.Services.AddHttpClient();
builder.Services.AddHttpContextAccessor();
builder.Services.AddResponseCompression();
var webAddress = builder.Configuration.GetValue<string>(AppConst.WebAddressKey);
if (string.IsNullOrWhiteSpace(webAddress))
{
    throw new ArgumentNullException(AppConst.WebAddressKey);
}

var app = builder.Build();
//#if DEBUG
await new BrowserFetcher { Browser = SupportedBrowser.Chrome }.DownloadAsync();
//#endif
app.UseSSRMiddleware();
app.UseResponseCompression();
app.Run("http://0.0.0.0:15051");